{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "import glob \n",
    "import pandas as pd\n",
    "  \n",
    "#获取指定目录下的所有图片 \n",
    "files = glob.glob('seq2seq*')\n",
    "dfs=[]\n",
    "\n",
    "for f in files:\n",
    "    print(f)\n",
    "    dfs.append(pd.read_csv(f))\n",
    "df_ensemble = pd.DataFrame(columns=[dfs[0].columns])\n",
    "df_ensemble.FORE_data = dfs[0].FORE_data\n",
    "df_ensemble[['       t2m', '      rh2m', '      w10m']] = 0\n",
    "\n",
    "df_ensemble = pd.DataFrame(columns=[dfs[0].columns])\n",
    "df_ensemble.FORE_data = dfs[0].FORE_data\n",
    "df_ensemble[['       t2m', '      rh2m', '      w10m']] = 0\n",
    "\n",
    "for i in range(len(dfs)):\n",
    "    df_ensemble[['       t2m', '      rh2m', '      w10m']] += dfs[i][['       t2m', '      rh2m', '      w10m']].values\n",
    "df_ensemble[['       t2m', '      rh2m', '      w10m']] = df_ensemble[['       t2m', '      rh2m', '      w10m']].values / len(dfs)\n",
    "\n",
    "df_ensemble.to_csv('./ensemble_avg_2018101503.csv', index=False)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
